import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)

export enum YcAction {
    YZB = "该操作代表，本题无法评阅，必须经系统管理员重新扫描或该题存在违规行为不予评阅!",
    CP_SOURCE = "该操作代表，本题将恢复至原始未评阅状态，并退回给原评阅教师重评!",
    REVIEWCORRECT = "该操作代表，未评阅的，撤销异常；已评阅的，采纳当前成绩并撤销异常!",
    CP_POINT = "该操作代表，本题将恢复至原始未评阅状态，并指定给指定教师重评!",
    WGWJWF = "该操作代表，该考生作答不符合考试规定做出相应的处罚!",
}


export enum ycClfunction {
    YZB = "上报系统管理员",
    CP_SOURCE = "重评-原评阅教师",
    ZYC = "退回资源池",
    WYC = "无异常(重评申请拒绝，系统异常判断无异常)",
    CP_POINT = "重评-指定教师(不含原评阅教师)",
    WGWJWF_STLF = "该试题0分处理",
    WGWJWF_KMLF = "该科目0分处理",
}

//YZB("上报系统管理员"),  CP_POINT("重评-指定老师(不含原评阅教师)"),  CP_SOURCE("重评-原评阅教师"), ZYC("退回资源池"), WYC("无异常(重评申请拒绝，系统异常判断无异常)"),




let lfYcList: any[] = []
import { getDictionaryList } from '/@/views/teacher/home/index'

async function getLfYyList() {
    lfYcList = await getDictionaryList('lfCode')
}
getLfYyList()


export const notReview = 'PY_DPY,PY_DCP'


export function zgtColumn(pyZtOptions) {
    return [
        {
            title: '阅卷教师',
            dataIndex: 'account',
            key: 'account',
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: '评阅状态',
            dataIndex: 'pyZt',
            key: 'pyZt',
            width: 100,
            align: 'center',
            customRender({ text }) {
                return pyZtOptions.find(e => e.value == text)?.label ?? '--'
            },
        },
        {
            title: '得分',
            dataIndex: 'pyZdf',
            key: 'pyZdf',
            align: 'center',
            width: 60,
            ellipsis: true,
        },
        {
            title: '提交时间',
            dataIndex: 'pyKssj',
            key: 'pyKssj',
            align: 'center',
            width: 160,
            ellipsis: true,
        },
        {
            title: '评阅时长',
            dataIndex: 'pyHs',
            key: 'pyHs',
            align: 'center',
            width: 100,
            customRender: ({ value }) => {
                return dayjs.duration(+new Date('2023-01-01') + value * 1000).format('mm分ss秒')
            },
        },
        {
            title: '零分原因',
            dataIndex: 'lfCode',
            key: 'lfCode',
            align: 'center',
            width: 100,
            customRender({ text, record }) {
                if (text == null) {
                    return '--'
                }
                let lfCodItem = lfYcList.find(e => e.value == text) || {}
                return `${lfCodItem.label}:(${record?.lfBz || '--'})`
            },
            ellipsis: true,
        },
        {
            title: '评阅备注',
            dataIndex: 'pyBz',
            key: 'pyBz',
            align: 'center',
            width: 100,
            customRender({ text }) {
                return text || '--'
            },
            ellipsis: true,
        },
    ]
}
